package cn.tramy.pinxian.wind.util

import cn.tramy.pinxian.wind.event.EventBus
import cn.tramy.pinxian.wind.interceptor.DomainTransactionSynchronization
import org.springframework.context.ApplicationContext
import org.springframework.transaction.support.TransactionSynchronizationManager

class WindApplicationUtil {
    companion object {
        var applicationContext: ApplicationContext? = null
        fun registerSynchronization() {
            this.applicationContext?.getBean(EventBus::class.java)?.let {
                TransactionSynchronizationManager.registerSynchronization(DomainTransactionSynchronization(it))
            }

        }
    }
}